////////////////////////////////////////////////
//	File			:	"Messages.cpp"
//
//	Author			:	Steven Seufert (SMS)
//			
//	Last Modified	:	January 18, 2012
//
//	Purpose			:	To implement all messages used by the message system
/////////////////////////////////////////////////
#include "Messages.h"

#include "../CPlayer.h"
#include "../CProximityRune.h"
#include "../CRemoteRune.h"
#include "../CDecoy.h"
#include "../CBarrier.h"
#include "../CFireball.h"
#include "../CFrostSpray.h"
#include "../CIceBlast.h"
#include "../CHealAlly.h"
#include "../CManaGift.h"
#include "../CHealingCircle.h"
#include "../CFortifyAlly.h"
#include "../CEmpower.h"
#include "../CRaiseDead.h"
#include "../CLifeDrain.h"
#include "../CPlague.h"
#include "../CSymbolOfFear.h"


CCreatePlayerMsg::CCreatePlayerMsg(int posX, int posY) : CBaseMessage (MSG_CREATE_PLAYER)
{
	m_nPosX = posX + 13;
	m_nPosY = posY;
}

CDestroyPlayerMsg::CDestroyPlayerMsg(CPlayer* pPlayer) : CBaseMessage (MSG_DESTROY_PLAYER)
{
	m_pPlayer = pPlayer;
	m_pPlayer->AddRef();
}
CDestroyPlayerMsg::~CDestroyPlayerMsg()
{
	if (m_pPlayer)
	{
		m_pPlayer->Release();
		m_pPlayer = NULL;
	}
}

///////////////////////////
//	Proximity Rune
///////////////////////////
CCreateProxRuneMsg::CCreateProxRuneMsg(int posX, int posY) : CBaseMessage (MSG_CREATE_PROXRUNE)
{
	m_nPosX = posX;
	m_nPosY = posY;
};

CDestroyProxRuneMsg::CDestroyProxRuneMsg(CProximityRune* pParamRune) : CBaseMessage (MSG_DESTROY_PROXRUNE)
{
	m_pRune = pParamRune;
	m_pRune->AddRef();
}
CDestroyProxRuneMsg::~CDestroyProxRuneMsg()
{
	if (m_pRune)
	{
		m_pRune->Release();
		m_pRune = NULL;
	}
}

///////////////////////////
//	Remote Rune
///////////////////////////
CCreateRemoteRuneMsg::CCreateRemoteRuneMsg(int posX, int posY) : CBaseMessage (MSG_CREATE_REMOTERUNE)
{
	m_nPosX = posX;
	m_nPosY = posY;
};

CDestroyRemoteRuneMsg::CDestroyRemoteRuneMsg(CRemoteRune* pParamRune) : CBaseMessage (MSG_DESTROY_REMOTERUNE)
{
	m_pRune = pParamRune;
	m_pRune->AddRef();
}
CDestroyRemoteRuneMsg::~CDestroyRemoteRuneMsg()
{
	if (m_pRune)
	{
		m_pRune->Release();
		m_pRune = NULL;
	}
}

///////////////////////////
//	Decoy
///////////////////////////
CCreateDecoyMsg::CCreateDecoyMsg(int posX, int posY) : CBaseMessage (MSG_CREATE_DECOY)
{
	m_nPosX = posX;
	m_nPosY = posY;
};

CDestroyDecoyMsg::CDestroyDecoyMsg(CDecoy* pParamDecoy) : CBaseMessage (MSG_DESTROY_DECOY)
{
	m_pDecoy = pParamDecoy;
	m_pDecoy->AddRef();
}
CDestroyDecoyMsg::~CDestroyDecoyMsg()
{
	if (m_pDecoy)
	{
		m_pDecoy->Release();
		m_pDecoy = NULL;
	}
}

///////////////////////////
//	Barrier
///////////////////////////
CCreateBarrierMsg::CCreateBarrierMsg(int posX, int posY) : CBaseMessage (MSG_CREATE_BARRIER)
{
	m_nPosX = posX;
	m_nPosY = posY;
};

CDestroyBarrierMsg::CDestroyBarrierMsg(CBarrier* pParamBarrier) : CBaseMessage (MSG_DESTROY_BARRIER)
{
	m_pBarrier = pParamBarrier;
	m_pBarrier->AddRef();
}
CDestroyBarrierMsg::~CDestroyBarrierMsg()
{
	if (m_pBarrier)
	{
		m_pBarrier->Release();
		m_pBarrier = NULL;
	}
}

///////////////////////////
//	Fireball
///////////////////////////
CCreateFireballMsg::CCreateFireballMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_FIREBALL)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyFireballMsg::CDestroyFireballMsg(CFireball* pParamFireball) : CBaseMessage (MSG_DESTROY_FIREBALL)
{
	m_pFireball = pParamFireball;
	m_pFireball->AddRef();
}
CDestroyFireballMsg::~CDestroyFireballMsg()
{
	if (m_pFireball)
	{
		m_pFireball->Release();
		m_pFireball = NULL;
	}
}

///////////////////////////
//	Frost Spray
///////////////////////////
CCreateFrostSprayMsg::CCreateFrostSprayMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_FROSTSPRAY_BULLET)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyFrostSprayMsg::CDestroyFrostSprayMsg(CFrostSpray* pParamFrostSpray) : CBaseMessage (MSG_DESTROY_FROSTSPRAY_BULLET)
{
	m_pFrostSpray = pParamFrostSpray;
	m_pFrostSpray->AddRef();
}
CDestroyFrostSprayMsg::~CDestroyFrostSprayMsg()
{
	if (m_pFrostSpray)
	{
		m_pFrostSpray->Release();
		m_pFrostSpray = NULL;
	}
}

///////////////////////////
//	Ice Blast
///////////////////////////
CCreateIceBlastMsg::CCreateIceBlastMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_ICEBLAST)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyIceBlastMsg::CDestroyIceBlastMsg(CIceBlast* pParamIceBlast) : CBaseMessage (MSG_DESTROY_ICEBLAST)
{
	m_pIceBlast = pParamIceBlast;
	m_pIceBlast->AddRef();
}
CDestroyIceBlastMsg::~CDestroyIceBlastMsg()
{
	if (m_pIceBlast)
	{
		m_pIceBlast->Release();
		m_pIceBlast = NULL;
	}
}

///////////////////////////
//	Heal Ally
///////////////////////////
CCreateHealAllyMsg::CCreateHealAllyMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_HEALALLY)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyHealAllyMsg::CDestroyHealAllyMsg(CHealAlly* pParamHealAlly) : CBaseMessage (MSG_DESTROY_HEALALLY)
{
	m_pHealAlly = pParamHealAlly;
	m_pHealAlly->AddRef();
}
CDestroyHealAllyMsg::~CDestroyHealAllyMsg()
{
	if (m_pHealAlly)
	{
		m_pHealAlly->Release();
		m_pHealAlly = NULL;
	}
}

///////////////////////////
//	Mana Gift
///////////////////////////
CCreateManaGiftMsg::CCreateManaGiftMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_MANAGIFT)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyManaGiftMsg::CDestroyManaGiftMsg(CManaGift* pParamManaGift) : CBaseMessage (MSG_DESTROY_MANAGIFT)
{
	m_pManaGift = pParamManaGift;
	m_pManaGift->AddRef();
}
CDestroyManaGiftMsg::~CDestroyManaGiftMsg()
{
	if (m_pManaGift)
	{
		m_pManaGift->Release();
		m_pManaGift = NULL;
	}
}

///////////////////////////
//	Healing Circle
///////////////////////////
CCreateHealingCircleMsg::CCreateHealingCircleMsg(int posX, int posY) : CBaseMessage (MSG_CREATE_HEALCIRCLE)
{
	m_nPosX = posX;
	m_nPosY = posY;
};

CDestroyHealingCircleMsg::CDestroyHealingCircleMsg(CHealingCircle* pParamHealingCircle) : CBaseMessage (MSG_DESTROY_HEALCIRCLE)
{
	m_pHealingCircle = pParamHealingCircle;
	m_pHealingCircle->AddRef();
}
CDestroyHealingCircleMsg::~CDestroyHealingCircleMsg()
{
	if (m_pHealingCircle)
	{
		m_pHealingCircle->Release();
		m_pHealingCircle = NULL;
	}
}

///////////////////////////
//	Fortify Ally
///////////////////////////
CCreateFortifyAllyMsg::CCreateFortifyAllyMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_FORTIFYALLY)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyFortifyAllyMsg::CDestroyFortifyAllyMsg(CFortifyAlly* pParamFortifyAlly) : CBaseMessage (MSG_DESTROY_FORTIFYALLY)
{
	m_pFortifyAlly = pParamFortifyAlly;
	m_pFortifyAlly->AddRef();
}
CDestroyFortifyAllyMsg::~CDestroyFortifyAllyMsg()
{
	if (m_pFortifyAlly)
	{
		m_pFortifyAlly->Release();
		m_pFortifyAlly = NULL;
	}
}

///////////////////////////
//	Empower
///////////////////////////
CCreateEmpowerMsg::CCreateEmpowerMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_EMPOWER)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyEmpowerMsg::CDestroyEmpowerMsg(CEmpower* pParamEmpower) : CBaseMessage (MSG_DESTROY_EMPOWER)
{
	m_pEmpower = pParamEmpower;
	m_pEmpower->AddRef();
}
CDestroyEmpowerMsg::~CDestroyEmpowerMsg()
{
	if (m_pEmpower)
	{
		m_pEmpower->Release();
		m_pEmpower = NULL;
	}
}

///////////////////////////
//	Raise Dead
///////////////////////////
CCreateRaiseDeadMsg::CCreateRaiseDeadMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_RAISEDEAD)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyRaiseDeadMsg::CDestroyRaiseDeadMsg(CRaiseDead* pParamRaiseDead) : CBaseMessage (MSG_DESTROY_RAISEDEAD)
{
	m_pRaiseDead = pParamRaiseDead;
	m_pRaiseDead->AddRef();
}
CDestroyRaiseDeadMsg::~CDestroyRaiseDeadMsg()
{
	if (m_pRaiseDead)
	{
		m_pRaiseDead->Release();
		m_pRaiseDead = NULL;
	}
}

///////////////////////////
//	Life Drain
///////////////////////////
CCreateLifeDrainMsg::CCreateLifeDrainMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_LIFEDRAIN_BULLET)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyLifeDrainMsg::CDestroyLifeDrainMsg(CLifeDrain* pParamLifeDrain) : CBaseMessage (MSG_DESTROY_LIFEDRAIN_BULLET)
{
	m_pLifeDrain = pParamLifeDrain;
	m_pLifeDrain->AddRef();
}
CDestroyLifeDrainMsg::~CDestroyLifeDrainMsg()
{
	if (m_pLifeDrain)
	{
		m_pLifeDrain->Release();
		m_pLifeDrain = NULL;
	}
}

///////////////////////////
//	Plague
///////////////////////////
CCreatePlagueMsg::CCreatePlagueMsg(int posX, int posY, float velX, float velY) : CBaseMessage (MSG_CREATE_PLAGUE)
{
	m_nPosX = posX;
	m_nPosY = posY;
	m_fVelX = velX;
	m_fVelY = velY;
};

CDestroyPlagueMsg::CDestroyPlagueMsg(CPlague* pParamPlague) : CBaseMessage (MSG_DESTROY_PLAGUE)
{
	m_pPlague = pParamPlague;
	m_pPlague->AddRef();
}
CDestroyPlagueMsg::~CDestroyPlagueMsg()
{
	if (m_pPlague)
	{
		m_pPlague->Release();
		m_pPlague = NULL;
	}
}


///////////////////////////
//	Symbol of Fear
///////////////////////////
CCreateSymbolOfFearMsg::CCreateSymbolOfFearMsg(int posX, int posY) : CBaseMessage (MSG_CREATE_FEARSYMBOL)
{
	m_nPosX = posX;
	m_nPosY = posY;
};

CDestroySymbolOfFearMsg::CDestroySymbolOfFearMsg(CSymbolOfFear* pParamSymbolOfFear) : CBaseMessage (MSG_DESTROY_PLAGUE)
{
	m_pSymbolOfFear = pParamSymbolOfFear;
	m_pSymbolOfFear->AddRef();
}
CDestroySymbolOfFearMsg::~CDestroySymbolOfFearMsg()
{
	if (m_pSymbolOfFear)
	{
		m_pSymbolOfFear->Release();
		m_pSymbolOfFear = NULL;
	}
}